package com.zjm.principle.crp;

/**
 * 违反 合成复用原则
 */
public class CompositeReuse01 {
    public static void main(String[] args) {
        Payment payment = new Alipay();
        payment.pay();
    }
}

abstract class Payment {
    public abstract void pay();
}

class Alipay extends Payment {
    @Override
    public void pay() {
        System.out.println("使用支付宝支付");
    }
}

class WechatPay extends Payment {
    @Override
    public void pay() {
        System.out.println("使用微信支付");
    }
}

class UnionPay extends Payment {
    @Override
    public void pay() {
        System.out.println("使用银联支付");
    }
}